package cn.wolfcode.wolf2w.controller;

import cn.wolfcode.wolf2w.domain.Destination;
import cn.wolfcode.wolf2w.domain.Spot;
import cn.wolfcode.wolf2w.query.SpotQuery;
import cn.wolfcode.wolf2w.service.IDestinationService;
import cn.wolfcode.wolf2w.service.ISpotService;
import cn.wolfcode.wolf2w.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("spot")
//Localhost：9999/spot/list
public class SpotController{
    @Autowired
    private ISpotService spotService;
    @Autowired
    private IDestinationService destinationService;

    @GetMapping("/list")
    public Object list(){
        //把spot对象塞进去在遍历取出来
        List<Spot> list = spotService.list();
        for (Spot spot : list) {
            System.out.println(spot);
        }
        return JsonResult.success(list);
    }


}
